<?php
declare(strict_types=1);
/**
 * MineAdmin is committed to providing solutions for quickly building web applications
 * Please view the LICENSE file that was distributed with this source code,
 * For the full copyright and license information.
 * Thank you very much for using MineAdmin.
 *
 * @Author X.Mo<root@imoi.cn>
 * @Link   https://gitee.com/xmo/MineAdmin
 */

namespace Plugin\Alarm\Http\Controller\Api;

use App\Http\Admin\Controller\AbstractController as AdminAbstractController;
use App\Http\Admin\Middleware\PermissionMiddleware;
use App\Http\Common\Middleware\AccessTokenMiddleware;
use App\Http\Common\Middleware\OperationMiddleware;
use App\Http\Common\Result;
use App\Http\CurrentUser;
use Hyperf\HttpServer\Annotation\Middleware;
use Hyperf\HttpServer\Request;
use Hyperf\Swagger\Annotation\Delete;
use Hyperf\Swagger\Annotation\Get;
use Hyperf\Swagger\Annotation\HyperfServer;
use Hyperf\Swagger\Annotation\JsonContent;
use Hyperf\Swagger\Annotation\Post;
use Hyperf\Swagger\Annotation\Put;
use Hyperf\Swagger\Annotation\RequestBody;
use Mine\Access\Attribute\Permission;
use Mine\Swagger\Attributes\PageResponse;
use Plugin\Alarm\Http\Request\Admin\RdAlarmMsgRequest;
use Plugin\Alarm\Schema\RdAlarmMsgSchema;
use Plugin\Alarm\Service\RdAlarmMsgService;

/**
 * 报警事件回调控制器
 * Class RdAlarmMsgApiController
 */
#[HyperfServer(name: 'http')]
final class RdAlarmMsgApiController extends AdminAbstractController
{

    /**
     * 业务处理服务
     * RdAlarmMsgService
     */
    public function __construct(
        protected readonly RdAlarmMsgService $service,
        protected readonly CurrentUser       $currentUser
    )
    {
    }

    #[Post(
        path: '/alarm/rdAlarmMsg/api/callback',
        summary: '报警事件回调',
        tags: ['报警事件回调控制器']
    )]
    #[PageResponse(instance: new Result())]
    public function callback(Request $request): Result
    {
        return $this->success($this->service->callback($request->all()));
    }

}